'''
菜单栏
'''

import sys,math
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class Menu(QMainWindow):
    def __init__(self):
        super(Menu, self).__init__()

        bar = self.menuBar()

        files = bar.addMenu("files")
        files.addAction('new')

        save = QAction("save", self)
        save.setShortcut("Ctrl + s")
        files.addAction(save)

        edit = bar.addMenu("Edit")
        run = QAction("run", self)
        debug = QAction("debug", self)
        edit.addAction(run)
        edit.addAction(debug)

        save.triggered.connect(self.process)

    def process(self, a):
        print(self.sender().text())
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Menu()
    ex.show()
    sys.exit(app.exec_())